﻿@model NB.MGJ.Model.Sys_User
@{
    Layout = null;
}

<form id="form_AddUser" role="form" onkeydown="if(event.keyCode==13){return false;}">
    <div class="RowAlgnTop">
        <div class="form-group col-xs-6 col-md-6">
            <div class="col-xs-4 col-md-4 text-right">
                <span style=" color:red;">*</span> 登录账号：
            </div>
            <div class="col-xs-8 col-md-8">
                @Html.TextBoxFor(p => p.LoginName, new
           {
               @class = "form-control",
               maxlength = 50,
               placeholder = "请输入登录账号"
           })
                @Html.ValidationMessageFor(p => p.LoginName)
            </div>
        </div>
        <div class="form-group col-xs-6 col-md-6">
            <div class="col-xs-4 col-md-4  text-right"><span style=" color:red;">*</span>密码：</div>
            <div class="col-xs-8 col-md-8">
                @Html.TextBoxFor(p => p.Pwd, new
           {
               @class = "form-control",
               maxlength = 18,
               placeholder = "请输入密码"
           })
                @Html.ValidationMessageFor(p => p.Pwd)
            </div>
        </div>

    </div>
    <div class="RowAlgnTop">
        <div class="form-group col-xs-6 col-md-6">
            <div class="col-xs-4 col-md-4 text-right">
                <span style=" color:red;">*</span>真实姓名：
            </div>
            <div class="col-xs-8 col-md-8">
                @Html.TextBoxFor(p => p.RealName, new { @class = "form-control", maxlength = 10, placeholder = "请输入真实姓名" })
                @Html.ValidationMessageFor(p => p.RealName)
            </div>
        </div>
        <div class="form-group col-xs-6 col-md-6">
            <div class="col-xs-4 col-md-4  text-right">所属机构：</div>
            <div class="col-xs-8 col-md-8">
                <input type="text" class="form-control" value="@ViewBag.EName" readonly="readonly" />
            </div>
        </div>
    </div>
    <div class="RowAlgnTop">
        <div class="form-group col-xs-6 col-md-6">
            <div class="col-xs-4 col-md-4 text-right">
                所属角色：
            </div>

            <div class="col-x
                 s-8 col-md-8">
                @Html.DropDownList("Rid", null, new { @class = "form-control dis" })

            </div>
        </div>
        <div class="form-group col-xs-6 col-md-6">
            <div class="col-xs-4 col-md-4  text-right">手机号：</div>
            <div class="col-xs-8 col-md-8">
                @Html.TextBoxFor(p => p.Modile, new
           {
               @class = "form-control",
               maxlength = 11,
               placeholder = "请输入手机号"
           })
                @Html.ValidationMessageFor(p => p.Modile)
            </div>
        </div>
    </div>
    <div class="RowAlgnTop">
        <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-right">
            <span>所在省：</span>
        </div>
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            <select class="form-control" id="ProvinceId" name="Province">
                <option>所在省</option>
            </select>
        </div>
        <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-right">
            <span>所在市：</span>
        </div>
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            <select class="form-control" id="City" name="City">
                <option>所在市</option>
            </select>
        </div>
    </div>
    <div class="RowAlgnTop">
        <div class="col-xs-2 col-md-2 text-right">
            备注：
        </div>
        <div class="col-xs-10 col-md-10">
            @Html.TextBoxFor(p => p.Remark, new { @class = "form-control", maxlength = 1000 })
            @Html.ValidationMessageFor(p => p.Remark)
        </div>
    </div>
</form>

<script>


    $(function () {
        $my.GetPCR(0, 0,0);
    });

    //input验证
    $('#form_AddUser').bootstrapValidator({
        message: '类型名称不能为空',
        excluded: [':disabled'],
        fields: {
            LoginName: {
                validators: {
                    notEmpty: {
                        message: '登录账号不能为空'
                    },
                    threshold: 1, //有6字符以上才发送ajax请求，（input中输入一个字符，插件会向服务器发送一次，设置限制，6字符以上才开始）
                    remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值，获得一个json数据。例表示正确：{"valid",true}  
                        type: "post",
                        url: "/Manager/CheckUserName",
                        message: '此登录账户已注册',
                        delay: 2000
                    },
                    stringLength: {
                        min: 4,
                        max: 50,
                        message: '登录账号长度必须在4到50位之间'
                    },
                    regexp: {
                        regexp: /^(?![^a-zA-Z]+$)(?!\d+$)/,
                        message: '登录账号必须包含数字和字母'
                    }
                }
            },
            Pwd: {
                validators: {
                    notEmpty: {
                        message: '密码不能为空'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9_]+$/,
                        message: '密码只能包含大写、小写、数字和下划线'
                    },
                    stringLength: {
                        min: 6,
                        max: 18,
                        message: '密码长度必须在6到18位之间'
                    }
                }
            },
            RealName: {
                validators: {
                    notEmpty: {
                        message: '真实姓名不能为空'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z\u4e00-\u9fa5]+$/,
                        message: '真实姓名不能输入符号和数字'
                    },
                    stringLength: {
                        max: 10,
                        message: '真实姓名最大长度为10',
                    },
                }
            },
            Modile: {
                validators: {
                    regexp: {
                        regexp: /^1[0-9]{10}$/,
                        message: '手机号码格式错误'
                    }
                }
            }
        }
    });


    //RealName

</script>